package controler;

import java.io.IOException;
import java.util.LinkedHashMap;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import persistence.Consulta;
import bean.FaixaCD;

public class BuscarServlet extends HttpServlet {
	
	private static final long serialVersionUID = 7903543890252704266L;

	@Override
	protected void doPost(HttpServletRequest request, 
						  HttpServletResponse response)
						  throws ServletException, IOException {
		
		LinkedHashMap<String,FaixaCD> faixas;
		Consulta c = new Consulta();
		String descricao = request.getParameter("descricao");
		
		faixas = c.buscarResultado(descricao);
		
		request.setAttribute("faixas", faixas);
		
		RequestDispatcher rd = request.getRequestDispatcher("ResultadoBuscaFaixa.jsp");
		rd.forward(request, response);
		
	}
	
}
